<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>热门促销 - 社交商城</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #ff4d4f;
            --primary-light: #ff7a7a;
            --secondary: #1890ff;
            --text-primary: #333333;
            --text-secondary: #666666;
            --text-tertiary: #999999;
            --bg-light: #f5f5f5;
            --bg-white: #ffffff;
            --border-light: #eeeeee;
            --radius: 8px;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
        }
        
        .nav-title {
            font-size: 18px;
            font-weight: 600;
            text-align: center;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        
        .nav-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 20px;
        }
        
        .nav-btn.primary {
            color: var(--primary);
        }
        
        /* 搜索栏 */
        .search-bar {
            padding: 12px 16px;
            background-color: var(--bg-white);
        }
        
        .search-input-group {
            position: relative;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 16px 10px 40px;
            border-radius: 24px;
            border: 1px solid var(--border-light);
            background-color: var(--bg-light);
            font-size: 14px;
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary);
            background-color: var(--bg-white);
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-tertiary);
        }
        
        /* 分类标签 */
        .category-tabs {
            display: flex;
            overflow-x: auto;
            padding: 8px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            scrollbar-width: none;
        }
        
        .category-tabs::-webkit-scrollbar {
            display: none;
        }
        
        .category-tab {
            padding: 6px 16px;
            margin-right: 8px;
            border-radius: 16px;
            font-size: 14px;
            white-space: nowrap;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: none;
        }
        
        .category-tab.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 促销列表 */
        .promotions-container {
            padding: 8px 16px;
        }
        
        .promotion-item {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            margin-bottom: 12px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: transform 0.2s ease;
        }
        
        .promotion-item:hover {
            transform: translateY(-2px);
        }
        
        .promotion-header {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
        }
        
        .user-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .user-info {
            flex: 1;
        }
        
        .user-name {
            font-size: 14px;
            font-weight: 500;
            margin-bottom: 2px;
        }
        
        .post-time {
            font-size: 12px;
            color: var(--text-tertiary);
        }
        
        .promotion-content {
            padding: 12px 16px;
        }
        
        .promotion-text {
            font-size: 15px;
            line-height: 1.5;
            margin-bottom: 12px;
        }
        
        .promotion-text .highlight {
            color: var(--primary);
            font-weight: 500;
        }
        
        /* 图片容器 - 支持多种图片数量布局 */
        .images-container {
            width: 100%;
            margin-bottom: 12px;
        }
        
        .no-image {
            background-color: var(--bg-light);
            height: 180px;
            border-radius: var(--radius);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
        }
        
        .single-image {
            width: 100%;
            height: 240px;
            border-radius: var(--radius);
            overflow: hidden;
        }
        
        .two-images {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 4px;
            height: 200px;
        }
        
        .three-images {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 4px;
        }
        
        .three-images .image-item:nth-child(1) {
            grid-column: 1 / 2;
            grid-row: 1 / 3;
            height: 100%;
        }
        
        .three-images .image-item:nth-child(2),
        .three-images .image-item:nth-child(3) {
            grid-column: 2 / 3;
            height: calc(50% - 2px);
        }
        
        .multiple-images {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
        }
        
        .image-item {
            border-radius: var(--radius);
            overflow: hidden;
            position: relative;
        }
        
        .image-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        
        .image-count {
            position: absolute;
            bottom: 4px;
            right: 4px;
            background-color: rgba(0, 0, 0, 0.6);
            color: white;
            font-size: 12px;
            padding: 2px 6px;
            border-radius: 10px;
        }
        
        /* 促销信息标签 */
        .promotion-tags {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .promotion-tag {
            padding: 3px 10px;
            border-radius: 4px;
            font-size: 12px;
        }
        
        .tag-discount {
            background-color: rgba(255, 77, 79, 0.1);
            color: var(--primary);
            border: 1px solid var(--primary);
        }
        
        .tag-time {
            background-color: rgba(24, 144, 255, 0.1);
            color: var(--secondary);
            border: 1px solid var(--secondary);
        }
        
        /* 倒计时 */
        .countdown {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: var(--primary);
            font-size: 13px;
            margin-bottom: 12px;
        }
        
        .countdown-value {
            background-color: var(--primary);
            color: white;
            width: 20px;
            height: 20px;
            border-radius: 3px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
        }
        
        /* 操作按钮 */
        .promotion-actions {
            display: flex;
            justify-content: space-between;
            padding: 8px 16px 12px;
            border-top: 1px solid var(--border-light);
        }
        
        .action-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 14px;
            padding: 4px 12px;
            border-radius: 4px;
        }
        
        .action-btn:hover {
            background-color: var(--bg-light);
        }
        
        .action-btn.liked {
            color: var(--primary);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-tertiary);
            font-size: 11px;
            gap: 4px;
            text-decoration: none;
            flex: 1;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 20px;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 70px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 加载更多 */
        .load-more {
            padding: 16px;
            text-align: center;
        }
        
        .load-more-btn {
            padding: 8px 24px;
            border-radius: 20px;
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin: 0 auto;
        }
        
        .load-more-btn.loading {
            color: var(--text-tertiary);
        }
        
        .load-more-btn.loading i {
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">热门促销</div>
        <button class="nav-btn primary" id="createBtn">
            <i class="fas fa-plus"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-bar">
        <div class="search-input-group">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索促销活动、优惠券...">
        </div>
    </div>
    
    <!-- 分类标签 -->
    <div class="category-tabs">
        <button class="category-tab active">全部</button>
        <button class="category-tab">限时折扣</button>
        <button class="category-tab">满减活动</button>
        <button class="category-tab">新品特惠</button>
        <button class="category-tab">优惠券</button>
        <button class="category-tab">会员专享</button>
        <button class="category-tab">组合优惠</button>
    </div>
    
    <!-- 促销列表 -->
    <div class="promotions-container" id="promotionsList">
        <!-- 无图片促销 -->
        <div class="promotion-item">
            <div class="promotion-header">
                <div class="user-avatar">
                    <img src="https://picsum.photos/id/237/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">时尚服饰旗舰店</div>
                    <div class="post-time">2小时前</div>
                </div>
            </div>
            <div class="promotion-content">
                <div class="promotion-text">
                    夏季清仓大促！全场<span class="highlight">3折起</span>，更有满300减50，满500减100活动！活动仅限3天，先到先得，错过再等一年！
                </div>
                
                <div class="promotion-tags">
                    <span class="promotion-tag tag-discount">3折起</span>
                    <span class="promotion-tag tag-discount">满减</span>
                    <span class="promotion-tag tag-time">限时3天</span>
                </div>
                
                <div class="countdown">
                    <i class="far fa-clock"></i>
                    <span>剩余时间:</span>
                    <span class="countdown-value">2</span>
                    <span>天</span>
                    <span class="countdown-value">18</span>
                    <span>时</span>
                    <span class="countdown-value">45</span>
                    <span>分</span>
                </div>
            </div>
            <div class="promotion-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span>128</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span>36</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 单张图片促销 -->
        <div class="promotion-item">
            <div class="promotion-header">
                <div class="user-avatar">
                    <img src="https://picsum.photos/id/91/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">数码电子专营店</div>
                    <div class="post-time">昨天 15:30</div>
                </div>
            </div>
            <div class="promotion-content">
                <div class="promotion-text">
                    新款无线蓝牙耳机首发特惠，原价399元，现价<span class="highlight">299元</span>，前100名下单送原装保护套！音质超赞，续航长达24小时！
                </div>
                
                <div class="images-container">
                    <div class="single-image image-item">
                        <img src="https://picsum.photos/id/96/800/600" alt="无线蓝牙耳机">
                    </div>
                </div>
                
                <div class="promotion-tags">
                    <span class="promotion-tag tag-discount">7.5折</span>
                    <span class="promotion-tag tag-discount">新品特惠</span>
                </div>
            </div>
            <div class="promotion-actions">
                <button class="action-btn like-btn liked">
                    <i class="fas fa-heart"></i>
                    <span>356</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span>89</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="fas fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 两张图片促销 -->
        <div class="promotion-item">
            <div class="promotion-header">
                <div class="user-avatar">
                    <img src="https://picsum.photos/id/64/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">美妆护肤官方店</div>
                    <div class="post-time">3天前</div>
                </div>
            </div>
            <div class="promotion-content">
                <div class="promotion-text">
                    夏日护肤套装特惠，购买任意两件产品<span class="highlight">第二件半价</span>！防晒霜+保湿喷雾组合仅需199元，限量500套！
                </div>
                
                <div class="images-container">
                    <div class="two-images">
                        <div class="image-item">
                            <img src="https://picsum.photos/id/21/400/400" alt="防晒霜">
                        </div>
                        <div class="image-item">
                            <img src="https://picsum.photos/id/24/400/400" alt="保湿喷雾">
                        </div>
                    </div>
                </div>
                
                <div class="promotion-tags">
                    <span class="promotion-tag tag-discount">第二件半价</span>
                    <span class="promotion-tag tag-time">限量500套</span>
                </div>
                
                <div class="countdown">
                    <i class="far fa-clock"></i>
                    <span>剩余时间:</span>
                    <span class="countdown-value">0</span>
                    <span>天</span>
                    <span class="countdown-value">8</span>
                    <span>时</span>
                    <span class="countdown-value">22</span>
                    <span>分</span>
                </div>
            </div>
            <div class="promotion-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span>245</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span>67</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 三张图片促销 -->
        <div class="promotion-item">
            <div class="promotion-header">
                <div class="user-avatar">
                    <img src="https://picsum.photos/id/25/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">家居生活广场</div>
                    <div class="post-time">4天前</div>
                </div>
            </div>
            <div class="promotion-content">
                <div class="promotion-text">
                    家居用品大促销，全场满200减50，满500减150！精选卧室、厨房、客厅三大区域爆款产品，<span class="highlight">最低5折</span>起！
                </div>
                
                <div class="images-container">
                    <div class="three-images">
                        <div class="image-item">
                            <img src="https://picsum.photos/id/163/400/800" alt="卧室用品">
                        </div>
                        <div class="image-item">
                            <img src="https://picsum.photos/id/118/400/400" alt="厨房用品">
                        </div>
                        <div class="image-item">
                            <img src="https://picsum.photos/id/174/400/400" alt="客厅用品">
                        </div>
                    </div>
                </div>
                
                <div class="promotion-tags">
                    <span class="promotion-tag tag-discount">满减</span>
                    <span class="promotion-tag tag-discount">5折起</span>
                    <span class="promotion-tag tag-time">活动7天</span>
                </div>
            </div>
            <div class="promotion-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span>189</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span>42</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="fas fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
        
        <!-- 四张及以上图片促销 -->
        <div class="promotion-item">
            <div class="promotion-header">
                <div class="user-avatar">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像">
                </div>
                <div class="user-info">
                    <div class="user-name">运动户外专营店</div>
                    <div class="post-time">1周前</div>
                </div>
            </div>
            <div class="promotion-content">
                <div class="promotion-text">
                    618年中大促提前开启！运动服装、鞋类、装备全场<span class="highlight">满300减100</span>，叠加店铺优惠券更划算！100+款商品参与活动！
                </div>
                
                <div class="images-container">
                    <div class="multiple-images">
                        <div class="image-item">
                            <img src="https://picsum.photos/id/28/300/300" alt="运动鞋">
                        </div>
                        <div class="image-item">
                            <img src="https://picsum.photos/id/29/300/300" alt="运动服">
                        </div>
                        <div class="image-item">
                            <img src="https://picsum.photos/id/30/300/300" alt="运动背包">
                            <span class="image-count">+8</span>
                        </div>
                    </div>
                </div>
                
                <div class="promotion-tags">
                    <span class="promotion-tag tag-discount">满300减100</span>
                    <span class="promotion-tag tag-discount">叠加优惠</span>
                    <span class="promotion-tag tag-time">618活动</span>
                </div>
            </div>
            <div class="promotion-actions">
                <button class="action-btn like-btn">
                    <i class="far fa-heart"></i>
                    <span>421</span>
                </button>
                <button class="action-btn comment-btn">
                    <i class="far fa-comment"></i>
                    <span>103</span>
                </button>
                <button class="action-btn share-btn">
                    <i class="far fa-share-alt"></i>
                    <span>分享</span>
                </button>
                <button class="action-btn save-btn">
                    <i class="far fa-bookmark"></i>
                    <span>收藏</span>
                </button>
            </div>
        </div>
    </div>
    
    <!-- 加载更多 -->
    <div class="load-more">
        <button class="load-more-btn" id="loadMoreBtn">
            <span>加载更多</span>
            <i class="fas fa-chevron-down"></i>
        </button>
    </div>
    
    <!-- 提示消息 -->
    <div class="toast" id="toast"></div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-tag nav-icon"></i>
            <span>促销</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-shopping-cart nav-icon"></i>
            <span>购物车</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const createBtn = document.getElementById('createBtn');
        const categoryTabs = document.querySelectorAll('.category-tab');
        const promotionsList = document.getElementById('promotionsList');
        const loadMoreBtn = document.getElementById('loadMoreBtn');
        const toast = document.getElementById('toast');
        
        // 返回按钮
        backBtn.addEventListener('click', () => {
            history.back();
        });
        
        // 创建按钮
        createBtn.addEventListener('click', () => {
            showToast('创建促销活动');
        });
        
        // 分类标签切换
        categoryTabs.forEach(tab => {
            tab.addEventListener('click', () => {
                // 移除所有标签的active类
                categoryTabs.forEach(t => t.classList.remove('active'));
                // 给当前点击的标签添加active类
                tab.classList.add('active');
                
                // 显示对应分类的促销内容
                showToast(`已切换到${tab.textContent}`);
            });
        });
        
        // 点赞功能
        document.addEventListener('click', (e) => {
            if (e.target.closest('.like-btn')) {
                const likeBtn = e.target.closest('.like-btn');
                const icon = likeBtn.querySelector('i');
                const countElement = likeBtn.querySelector('span');
                let count = parseInt(countElement.textContent);
                
                if (icon.classList.contains('far')) {
                    // 点赞
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    likeBtn.classList.add('liked');
                    countElement.textContent = count + 1;
                    showToast('点赞成功');
                } else {
                    // 取消点赞
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    likeBtn.classList.remove('liked');
                    countElement.textContent = count - 1;
                    showToast('已取消点赞');
                }
            }
            
            // 评论功能
            if (e.target.closest('.comment-btn')) {
                const commentBtn = e.target.closest('.comment-btn');
                const promotionItem = commentBtn.closest('.promotion-item');
                const userName = promotionItem.querySelector('.user-name').textContent;
                showToast(`查看${userName}的促销评论`);
            }
            
            // 分享功能
            if (e.target.closest('.share-btn')) {
                showToast('分享链接已复制');
            }
            
            // 收藏功能
            if (e.target.closest('.save-btn')) {
                const saveBtn = e.target.closest('.save-btn');
                const icon = saveBtn.querySelector('i');
                
                if (icon.classList.contains('far')) {
                    icon.classList.remove('far');
                    icon.classList.add('fas');
                    showToast('收藏成功');
                } else {
                    icon.classList.remove('fas');
                    icon.classList.add('far');
                    showToast('已取消收藏');
                }
            }
        });
        
        // 加载更多
        loadMoreBtn.addEventListener('click', function() {
            // 显示加载中状态
            this.innerHTML = '<span>加载中</span><i class="fas fa-spinner"></i>';
            this.classList.add('loading');
            
            // 模拟加载延迟
            setTimeout(() => {
                // 创建新的促销项
                const newItems = createPromotionItems(3);
                
                // 添加到列表
                newItems.forEach(item => {
                    promotionsList.appendChild(item);
                });
                
                // 恢复按钮状态
                this.innerHTML = '<span>加载更多</span><i class="fas fa-chevron-down"></i>';
                this.classList.remove('loading');
                
                showToast('已加载更多促销');
            }, 1500);
        });
        
        // 创建促销项
        function createPromotionItems(count) {
            const items = [];
            const stores = ['生鲜食品超市', '母婴用品店', '文具书店', '宠物用品店', '运动健身馆'];
            const promotions = [
                '会员日特惠，所有商品8折优惠，更有专属赠品等你来拿！',
                '新品上市，尝鲜价仅需99元，购买即送精美礼品一份。',
                '限时秒杀！每天10点、15点、20点三个时段，爆款商品低至1元！',
                '满100减20，满200减50，多买多省，优惠不封顶！',
                '组合套餐特惠，原价299元，现价199元，立省100元！'
            ];
            const tags = [
                ['限时折扣', '会员专享'],
                ['新品特惠', '限量'],
                ['秒杀', '1元起'],
                ['满减', '多买多省'],
                ['组合优惠', '立省']
            ];
            
            for (let i = 0; i < count; i++) {
                const random = Math.floor(Math.random() * 5);
                const imageCount = Math.floor(Math.random() * 5); // 0-4张图片
                const storeIndex = Math.floor(Math.random() * stores.length);
                const likeCount = Math.floor(Math.random() * 500);
                const commentCount = Math.floor(Math.random() * 100);
                const daysAgo = Math.floor(Math.random() * 7) + 1;
                
                // 创建促销项
                const item = document.createElement('div');
                item.className = 'promotion-item';
                
                // 构建图片容器
                let imageContainer = '';
                if (imageCount === 0) {
                    imageContainer = `
                        <div class="images-container">
                            <div class="no-image">
                                <i class="fas fa-image fa-2x"></i>
                            </div>
                        </div>
                    `;
                } else if (imageCount === 1) {
                    imageContainer = `
                        <div class="images-container">
                            <div class="single-image image-item">
                                <img src="https://picsum.photos/id/${30 + i}/800/600" alt="促销图片">
                            </div>
                        </div>
                    `;
                } else if (imageCount === 2) {
                    imageContainer = `
                        <div class="images-container">
                            <div class="two-images">
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${40 + i}/400/400" alt="促销图片">
                                </div>
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${50 + i}/400/400" alt="促销图片">
                                </div>
                            </div>
                        </div>
                    `;
                } else if (imageCount === 3) {
                    imageContainer = `
                        <div class="images-container">
                            <div class="three-images">
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${60 + i}/400/800" alt="促销图片">
                                </div>
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${70 + i}/400/400" alt="促销图片">
                                </div>
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${80 + i}/400/400" alt="促销图片">
                                </div>
                            </div>
                        </div>
                    `;
                } else { // 4张及以上
                    imageContainer = `
                        <div class="images-container">
                            <div class="multiple-images">
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${90 + i}/300/300" alt="促销图片">
                                </div>
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${100 + i}/300/300" alt="促销图片">
                                </div>
                                <div class="image-item">
                                    <img src="https://picsum.photos/id/${110 + i}/300/300" alt="促销图片">
                                    <span class="image-count">+${imageCount - 3}</span>
                                </div>
                            </div>
                        </div>
                    `;
                }
                
                // 构建标签
                let tagHtml = '';
                tags[random].forEach(tag => {
                    const tagClass = tag.includes('折') || tag.includes('减') || tag.includes('省') || tag.includes('元') 
                        ? 'tag-discount' 
                        : 'tag-time';
                    tagHtml += `<span class="promotion-tag ${tagClass}">${tag}</span>`;
                });
                
                // 随机是否显示倒计时
                const showCountdown = Math.random() > 0.5;
                let countdownHtml = '';
                if (showCountdown) {
                    const hours = Math.floor(Math.random() * 24);
                    const minutes = Math.floor(Math.random() * 60);
                    countdownHtml = `
                        <div class="countdown">
                            <i class="far fa-clock"></i>
                            <span>剩余时间:</span>
                            <span class="countdown-value">0</span>
                            <span>天</span>
                            <span class="countdown-value">${hours}</span>
                            <span>时</span>
                            <span class="countdown-value">${minutes}</span>
                            <span>分</span>
                        </div>
                    `;
                }
                
                // 组装促销项HTML
                item.innerHTML = `
                    <div class="promotion-header">
                        <div class="user-avatar">
                            <img src="https://picsum.photos/id/${10 + i}/100/100" alt="用户头像">
                        </div>
                        <div class="user-info">
                            <div class="user-name">${stores[storeIndex]}</div>
                            <div class="post-time">${daysAgo}天前</div>
                        </div>
                    </div>
                    <div class="promotion-content">
                        <div class="promotion-text">
                            ${promotions[random]}
                        </div>
                        
                        ${imageContainer}
                        
                        <div class="promotion-tags">
                            ${tagHtml}
                        </div>
                        
                        ${countdownHtml}
                    </div>
                    <div class="promotion-actions">
                        <button class="action-btn like-btn">
                            <i class="far fa-heart"></i>
                            <span>${likeCount}</span>
                        </button>
                        <button class="action-btn comment-btn">
                            <i class="far fa-comment"></i>
                            <span>${commentCount}</span>
                        </button>
                        <button class="action-btn share-btn">
                            <i class="far fa-share-alt"></i>
                            <span>分享</span>
                        </button>
                        <button class="action-btn save-btn">
                            <i class="far fa-bookmark"></i>
                            <span>收藏</span>
                        </button>
                    </div>
                `;
                
                items.push(item);
            }
            
            return items;
        }
        
        // 提示消息功能
        function showToast(message) {
            toast.textContent = message;
            toast.classList.add('show');
            
            setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
        
        // 倒计时更新
        function updateCountdowns() {
            document.querySelectorAll('.countdown').forEach(countdown => {
                const values = countdown.querySelectorAll('.countdown-value');
                if (values.length >= 3) {
                    let days = parseInt(values[0].textContent);
                    let hours = parseInt(values[1].textContent);
                    let minutes = parseInt(values[2].textContent);
                    
                    minutes--;
                    if (minutes < 0) {
                        minutes = 59;
                        hours--;
                        if (hours < 0) {
                            hours = 23;
                            days--;
                            if (days < 0) {
                                days = 0;
                                hours = 0;
                                minutes = 0;
                            }
                        }
                    }
                    
                    values[0].textContent = days;
                    values[1].textContent = hours;
                    values[2].textContent = minutes;
                }
            });
        }
        
        // 每分钟更新一次倒计时
        setInterval(updateCountdowns, 60000);
    </script>
</body>
</html>

